#ifndef AUTHORIZATION_H
#define AUTHORIZATION_H

#include <QWidget>
#include <QFormLayout>
#include <QBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QtSql/QSqlQuery>
#include <iostream>
#include <fstream>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
typedef int SOCKET;

const int PORT = 8080;
const int BUFFER_SIZE = 1024;

extern QString globalNickname;
QString clientStartNickname();
extern SOCKET clientSock;
extern SOCKET clientSocket;

class Authorization : public QWidget
{
public:
    explicit Authorization(QWidget *parent = nullptr);

private:

    QVBoxLayout* vLayout;
    QHBoxLayout* hLayout;
    QFormLayout* formLayout;
    QLabel* topNameLabel;
    QLabel* infoLabel;
    QLineEdit* nickEdit;
    QLineEdit* passwordEdit;

    QLabel* authPageLabel;
    QPushButton* authPageButton;
    QPushButton* authButton;

    void connectServer();
    void Registration();
    void Entrance();
    void buildEntrance();
    void connection();

private slots:
    void regimeChange();
    void authActions();
};

#endif // AUTHORIZATION_H
